package cn.edu.fzu.homemaking.web;

import lombok.Data;

@Data
public final class Result {

    public static Result SUCCESS = new Result();

    // 返回码
    private int          code;
    // 返回结果
    private Object       value;
    // 错误消息
    private String       message;

    private String       redirectUrl;

    public Result() {
        this.code = RetCode.SUCCESS;
    }


    /**
     * 默认返回值为 200(成功)
     *
     * @param value
     */
    public Result(Object value) {
        this.code = RetCode.SUCCESS;
        this.value = value;
        this.message = null;
    }


    public Result(int code, String message) {
        this.code = code;
        this.message = message;
        this.value = null;
    }


    public Result(int code, Object value, String message, String redirectUrl) {
        this.code = code;
        this.value = value;
        this.message = message;
        this.redirectUrl = redirectUrl;
    }

}
